<?php
/*tz5em4Qu3tH2
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of connection
 *
 * @author IT
 */
class connection {
    function ketnoi($query){
        $ketnoi = mysql_connect('localhost','root','vertrigo');
        mysql_select_db('baocao',$ketnoi);
        mysql_query('SET character_set_result = utf8',$ketnoi);
        $ret = mysql_query($query) or die('kết nối dữ liệu thất bại');
        return $ret;
    }
    function laydulieu($query){
        $ret = $this->ketnoi($query);
        $data = array();
        while ($row = mysql_fetch_assoc($ret)){
            $data[]=$row;
        }
        return $data;
    }
}
